<template>
  <scoring-template :initData="updateData" :title="title" @save="getUpdateData">
  </scoring-template>
</template>

<script>
  import ScoringTemplate from '../../base/quality-template/ScoringForm'
  export default {
    name: 'UpdateScoringTemplate',
    data () {
      return {
        title: this.$t('configLazyLoad.qualityCheck.editScoringTemplate'),
        updateData: {
          _id: '',
          enable: '',
          name: this.$t('configLazyLoad.qualityCheck.qualityTempName'),
          QUALITY_TYPE: '',
          memo: '123',
          'A-begin': 95,
          'B-begin': 80,
          'B-end': 94,
          'C-begin': 60,
          'C-end': 79,
          'D-end': 59,
          config: [{
            order: 1,
            name: this.$t('configLazyLoad.qualityCheck.professionalLevel'),
            weight: 40
          }, {
            order: 2,
            name: this.$t('configLazyLoad.qualityCheck.attitude&tone'),
            weight: 30
          }, {
            order: 3,
            name: this.$t('configLazyLoad.qualityCheck.solutionLevel'),
            weight: 30
          }]
        }
      }
    },
    props: {
      initData: {
        type: Object,
        object: function () {
          return {
            _id: '',
            enable: '',
            name: this.$t('configLazyLoad.qualityCheck.qualityTempName'),
            QUALITY_TYPE: '',
            memo: '123',
            'A-begin': 95,
            'B-begin': 80,
            'B-end': 94,
            'C-begin': 60,
            'C-end': 79,
            'D-end': 59,
            gradeConfig:[],
            config: [{
              order: 1,
              name: this.$t('configLazyLoad.qualityCheck.professionalLevel'),
              weight: 40
            }, {
              order: 2,
              name: this.$t('configLazyLoad.qualityCheck.attitude&tone'),
              weight: 30
            }, {
              order: 3,
              name: this.$t('configLazyLoad.qualityCheck.solutionLevel'),
              weight: 30
            }]
          }
        }
      }
    },
    watch: {
      initData (cur) {
        this.updateData = cur
      }
    },
    components: {
      ScoringTemplate
    },
    methods: {
      getUpdateData (data) {
        this.$emit('update', data)
      }
    },
    beforeMount () {
      this.updateData = JSON.parse(JSON.stringify(this.initData))
    }
  }
</script>
